# global variables
"""
int m1
int m2
int m3
int angle
"""


m1 = m2 = m3 = angle = 0

def display():
	print "\nUse the keys W,A,S,D and the arrow pad to control the robot: \n"
	print "Motor1: %d\n" % (m1)
	print "Motor2: %d\n" % (m2)
	print "Motor3: %d\n" % (m3)
	print "Current angle: %d\n" % (angle)

def m1Change(sign):
	if (sign > 0):
		if (m1 <= 3200):
			m1 += 320
	elif (sign < 0):
		if (m1 >= -3200):
			m1 += (-1)*(320)

def m2Change(sign):
	if (sign > 0):
		if (m2 <= 3200):
			m2 += 320
	elif (sign < 0):
		if (m2 >= 3200):
			m2 += -320

def m3Change(sign): 
	if (sign > 0):
		if (m3 <= 3200):
			m3 += 320
	elif (sign < 0):
		if (m3 >= 3200):
			m3 += -320


running = 1

#m1 = m2 = m3 = angle = 0

while running:
	display()
	ui = raw_input()

	if ui == 'w':
		m1Change(1)
		m2Change(1)
	elif ui == 's':
		m1Change(-1)
		m2Change(-1)
	elif ui == 'a':
		m3Change(1)
		m2Change(-1)
	elif ui == 'd':
		m3Change(1)
		m1Change(-1)
